﻿using Hong.Business.Business_AttendanceManagement;
using Hong.Business.Business_ContractManagement;
using Hong.Model.SysDomain.Model_AttendanceManagement;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;

namespace WeHongshibApI.Controllers.Controllers_AttendanceManagement
{
    [ApiExplorerSettings(GroupName = "Attendance")]
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AttendanceController : ControllerBase
    {
        #region 构造器注入
        private readonly AttendanceBusiness _attendanceBusiness;
        public AttendanceController(AttendanceBusiness attendanceBusiness)
        {
            _attendanceBusiness = attendanceBusiness;
        }
        #endregion
        #region 添加申请
        [HttpPost]
        public IActionResult AddRequest(Guid? currentStaffId, string currentStaffName, RequestInfo requestInfo)
        {
            return Ok(_attendanceBusiness.AddRequest(currentStaffId, currentStaffName, requestInfo)) ;
        }
        #endregion
        #region 获取请假类型
        [HttpGet]
        public IActionResult GetDictionaries()
        {
            return Ok(_attendanceBusiness.GetDictionaries());
        }
        #endregion

        #region 获取申请列表
        [HttpGet]
        public IActionResult GetRequestInfos(string type)
        {
            return Ok(_attendanceBusiness.GetRequestInfos(type)) ;
        }
        #endregion

        #region 审批
        [HttpPost]
        public IActionResult Approval(InstantiationInfo instantiationInfo)

        {
            return Ok(_attendanceBusiness.Approval(instantiationInfo)) ;
        }
        #endregion
        #region 节假日设置

        #region 添加节假日
        [HttpPost]
        public IActionResult AddHolday(HolidaysInfo holidaysInfo)
        {
            return Ok(_attendanceBusiness.AddHolday(holidaysInfo));
        }
        #endregion

        #region 显示节假日
        [HttpGet]
        public IActionResult Showholday(string year)
        {
            return Ok(_attendanceBusiness.Showholday(year)) ;
        }
        #endregion

        #region 删除节假日
        [HttpGet]
        public IActionResult DelHoliday(int holidayID)
        {
            return Ok(_attendanceBusiness.DelHoliday(holidayID)) ;
        }
        #endregion

        #endregion

        #region 特殊工作日设置

        #region 添加特殊工作日
        [HttpPost]
        public IActionResult AddWorkDay(WorkdayInfo workdayInfo)
        {
            return Ok(_attendanceBusiness.AddWorkDay(workdayInfo)) ;
        }
        #endregion

        #region 显示特殊工作日
        [HttpGet]
        public IActionResult ShowWorkDay(string year)
        {
            return Ok(_attendanceBusiness.ShowWorkDay(year)) ;
        }
        #endregion

        #region 删除特殊工作日
        [HttpGet]
        public IActionResult DelWorkDay(int workdayID)
        {
            return Ok(_attendanceBusiness.DelWorkDay(workdayID) );
        }
        #endregion

        #endregion
    }
}
